package com.haoting.mamba.player.service.impl;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.haoting.common.utils.PageUtils;
import com.haoting.common.utils.Query;

import com.haoting.mamba.player.dao.PlayerInformationDao;
import com.haoting.mamba.player.entity.PlayerInformationEntity;
import com.haoting.mamba.player.service.PlayerInformationService;


@Service("playerInformationService")
public class PlayerInformationServiceImpl extends ServiceImpl<PlayerInformationDao, PlayerInformationEntity> implements PlayerInformationService {

    @Override
    public String saveInformation(PlayerInformationEntity playerInformation) {
        PlayerInformationEntity blogInfo = new PlayerInformationEntity();
        BeanUtils.copyProperties(playerInformation,blogInfo);
        int insert = baseMapper.insert(blogInfo);
        String bid = blogInfo.getId();
        return bid;
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<PlayerInformationEntity> page = this.page(
                new Query<PlayerInformationEntity>().getPage(params),
                new QueryWrapper<PlayerInformationEntity>()
                .like("name",params.get("key"))
                .or()
                .like("english",params.get("key"))
        );
        System.out.println(params.get("key"));


        return new PageUtils(page);
    }

}